/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tuplestoreserver;

import core.IServerCallBack;
import core.ProtocolSD;

/**
 *
 * @author Jorge
 */
public class MasterClientListener implements ProtocolSD.IProtocolListener{

    private boolean close=false;

    private IServerCallBack callBack;
    

    public void onReadHeader(int operation, int numArgs, ProtocolSD protocolSD) {
        callBack.onReadHeader(operation, numArgs, protocolSD);
    }

    public void onReadArgument(byte[] data, ProtocolSD protocolSD) {
        callBack.onReadArgument(data, protocolSD);
    }

    public void onReadArgumentSize(int size, ProtocolSD protocolSD) {
        callBack.onReadArgumentSize(size, protocolSD);
    }

    public void onReadAllArguments(ProtocolSD protocolSD) {
        callBack.onReadAllArguments(protocolSD);
        close=true;
    }

    public void onWriteComplete(ProtocolSD protocolSD) {
        callBack.onWriteComplete(protocolSD);
    }

    public void setCallBack(IServerCallBack callback) {
        this.callBack = callback;
    }

    public IServerCallBack getCallBack() {
        return callBack;
    }

    public void onReadParcialParam(byte[] readedBytes, int offset, int limit, ProtocolSD protocolSD) {
        this.callBack.onReadParcialParam(readedBytes, offset, limit);
    }

    public void onAcceptConnect() {
        this.callBack.onFinishConnect();
    }

    public boolean isClose() {
        return close;
    }

}
